package com.atguigu.gmall.realtime.util;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @Author lzc
 * @Date 2023/5/5 10:59
 */
public class ThreadPoolUtil {
    public static ThreadPoolExecutor getThreadPool(){
        return new ThreadPoolExecutor(
            300, // 核心线程数
            500, // 最大线程数
            60, //空闲线程的存活时间
            TimeUnit.SECONDS,
            new LinkedBlockingQueue<>() //阻塞队列: 存储需要排队的任务
        );
    }
}
